home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16954 < prev    next >
Encoding:
Text File  |  1996-08-05  |  944 b   |  47 lines

  1. Path: maui.cc.odu.edu!news
  2. From: "CLEVELAND O. BURNETT" <cob@cs.odu.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: READING FROM A TEXTFILE
  5. Date: Fri, 12 Apr 1996 12:33:04 -0400 (EDT)
  6. Organization: Old Dominion University
  7. Message-ID: <Pine.SUN.3.90.960412122731.1477A-100000@dew.cs.odu.edu>
  8. NNTP-Posting-Host: dew.cs.odu.edu
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11.  
  12.  
  13.     I have had trouble reading from a textfile.  I am trying to read 
  14. a textfile into a C++ struct.  This is the struct
  15.  
  16.  
  17.  
  18.  
  19. #include <iostream.h>
  20. #include <fstream.h>
  21.  
  22.  
  23.  struct students {
  24. char firstname[20];
  25. char middle_initial;
  26. char lastname[20];
  27. char address1[40];
  28. char address2[30];
  29. char phone_number[7];
  30. char email[50];
  31. char dept[16];
  32. char edu_level[9];
  33. };
  34.  
  35.  
  36. The textfile has contains char firstname down to edu_level --- each char 
  37. string is one line in the file.
  38.  
  39. How can I read this struct from the textfile?
  40.  
  41.  
  42.  
  43. Help me?
  44.  
  45.                 thank you,
  46.                     Cleveland Burnett
  47.